---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\fsu2010\formateur\ajps\submission2\replication\analysis\compprob.log
  log type:  text
 opened on:   6 Dec 2010, 15:55:55

. #delimit ;
delimiter now ;
. set mem 30m;

Current memory allocation

                    current                                 memory usage
    settable          value     description                 (1M = 1024k)
    --------------------------------------------------------------------
    set maxvar         5000     max. variables allowed           1.947M
    set memory           30M    max. data space                 30.000M
    set matsize         400     max. RHS vars in models          1.254M
                                                            -----------
                                                                33.201M

. clear matrix;

. clear mata;

.  set more off;

. *     ***************************************************************** *;
. *     ***************************************************************** *;
. *       File-Name:  compprob.do                                         *;
. *       Date:       December 6, 2010                                    *;
. *       Author:     GG/MG                                               *;
. *       Purpose:    Produce 3 in Appendix D of SI for the AJPS paper    *;
. *       Input File:     europe.dta                                      *;
. *       Output File:    compprob.log                                    *;
. *       Data Output:    none                                            *;
. *       Previous file:  europe.dta                                      *;
. *       Machine:        Matt's desktop                                  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Do a comparison of MXL and CL probabilities                     *;
. *     ****************************************************************  *;
. use "C:\fsu2010\formateur\ajps\submission2\replication\analysis\europe.dta", clear;

. generate tempseats = party_seatshare;

. by cabinetcode: egen tseats = max(tempseats);

. replace tempseats = 0 if largestparty==1;
(372 real changes made)

. by cabinetcode: egen tseats2 = max(tempseats);

. generate ss2 = party_seatshare;

. replace ss2 = tseats if party_seatshare==tseats2;
(381 real changes made)

. replace ss2 = tseats2 if party_seatshare==tseats;
(372 real changes made)

. generate ss2e = ss2 * east;

. generate largep2 = 0;

. replace largep2 = 1 if party_seatshare==tseats2;
(381 real changes made)

. generate largep2e = largep2 * east;

. generate ss3 = party_seatshare;

. generate largep3 = largestparty;

. generate ss3e = party_seatshare_east;

. generate largep3e = largestparty_east;

. clogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east previousPM_conflict_east previousPM_gain1_east previous_cabinet_gain1_east 
> largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct previousPM_conflict previousPM_gain1 previous_cabinet_gain1, group(cabinetcode);

Iteration 0:   log likelihood = -259.26598  
Iteration 1:   log likelihood = -253.62196  
Iteration 2:   log likelihood = -229.48762  
Iteration 3:   log likelihood = -229.12527  
Iteration 4:   log likelihood = -229.12428  
Iteration 5:   log likelihood = -229.12428  

Conditional (fixed-effects) logistic regression   Number of obs   =       2039
                                                  LR chi2(18)     =     676.86
                                                  Prob > chi2     =     0.0000
Log likelihood = -229.12428                       Pseudo R2       =     0.5963

------------------------------------------------------------------------------
      choice |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
largestp~ast |  -.5553664   .8193583    -0.68   0.498    -2.161279    1.050546
party_se~ast |   .1350519    .070639     1.91   0.056    -.0033981    .2735019
medianpa~ast |  -1.397295   .7507114    -1.86   0.063    -2.868663     .074072
presi~y_east |   .5460676   .9797752     0.56   0.577    -1.374256    2.466392
previ~M_east |  -.5906285   .8963622    -0.66   0.510    -2.347466    1.166209
previ~t_east |   .1976854   1.204658     0.16   0.870    -2.163401    2.558772
previousPM.. |  -.0502768   .1498107    -0.34   0.737    -.3439004    .2433469
previous_c.. |   .0112033   .0713777     0.16   0.875    -.1286944     .151101
largestparty |    .513825   .2530113     2.03   0.042     .0179321    1.009718
party_seat~e |   .0920104   .0131823     6.98   0.000     .0661737    .1178472
medianparty1 |   .8034385   .1912084     4.20   0.000     .4286769      1.1782
presidentp~y |   2.344388   .8603292     2.72   0.006     .6581738    4.030602
  previousPM |   .9622781   .2453506     3.92   0.000     .4813998    1.443156
president_~e |  -1.812223   .7187738    -2.52   0.012    -3.220994   -.4034521
president~ct |  -1.944626   .7822903    -2.49   0.013    -3.477887    -.411365
previousP~ct |  -.7414724   .3545053    -2.09   0.036     -1.43629   -.0466549
previousPM~1 |   .1610095   .0424693     3.79   0.000     .0777713    .2442477
previous_c~1 |   .0060267   .0110097     0.55   0.584    -.0155519    .0276052
------------------------------------------------------------------------------

. predict clprob, p;
(373 missing values generated)

. replace largestparty = largep2;
(753 real changes made)

. replace party_seatshare = ss2;
(753 real changes made)

. replace largestparty_east = largep2e;
(148 real changes made)

. replace party_seatshare_east = ss2e;
(148 real changes made)

. predict clprob2, p;
(373 missing values generated)

. replace largestparty = largep3;
(753 real changes made)

. replace party_seatshare = ss3;
(753 real changes made)

. replace largestparty_east = largep3e;
(148 real changes made)

. replace party_seatshare_east = ss3e;
(148 real changes made)

. mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east previousPM_conflict_east previousPM_gain1_east previous_cabinet_gain1_east,  
>     rand (largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct previousPM_conflict previousPM_gain1 previous_cabinet_gain1) 
>     ln(0) nrep(125) group(cabinetcode);

Iteration 0:   log likelihood = -255.29786  (not concave)
Iteration 1:   log likelihood = -245.38797  (not concave)
Iteration 2:   log likelihood =  -228.8695  
Iteration 3:   log likelihood = -221.24204  (not concave)
Iteration 4:   log likelihood = -221.16184  (not concave)
Iteration 5:   log likelihood = -220.39987  
Iteration 6:   log likelihood = -219.61402  
Iteration 7:   log likelihood = -219.46931  
Iteration 8:   log likelihood = -219.42816  (not concave)
Iteration 9:   log likelihood = -219.41127  (not concave)
Iteration 10:  log likelihood = -219.40734  (not concave)
Iteration 11:  log likelihood = -219.38014  
Iteration 12:  log likelihood = -219.35916  
Iteration 13:  log likelihood = -219.35268  
Iteration 14:  log likelihood = -219.35266  

Mixed logit model                                 Number of obs   =       2039
                                                  LR chi2(10)     =      19.54
Log likelihood = -219.35266                       Prob > chi2     =     0.0339

------------------------------------------------------------------------------
      choice |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Mean         |
largestp~ast |  -1.253544   2.017873    -0.62   0.534    -5.208503    2.701414
party_se~ast |   .2877481   .1444587     1.99   0.046     .0046143    .5708819
medianpa~ast |  -3.117227   1.721757    -1.81   0.070    -6.491809    .2573546
presi~y_east |  -.4970681   1.853252    -0.27   0.789    -4.129376     3.13524
previ~M_east |   -2.19965   2.606521    -0.84   0.399    -7.308337    2.909037
previ~t_east |   1.126725   3.208478     0.35   0.725    -5.161776    7.415226
previousPM.. |  -.0930831   .4810077    -0.19   0.847    -1.035841    .8496747
previous_c.. |   .0517841   .1988117     0.26   0.795    -.3378797    .4414479
largestparty |   2.109019   1.104417     1.91   0.056    -.0555996    4.273637
party_seat~e |   .1351541   .0258657     5.23   0.000     .0844583    .1858498
medianparty1 |   1.392319   .3828235     3.64   0.000     .6419985    2.142639
presidentp~y |   5.250695   2.428888     2.16   0.031      .490162    10.01123
  previousPM |   2.841572   1.038968     2.73   0.006     .8052325    4.877912
president_~e |  -3.060496   2.130412    -1.44   0.151    -7.236027    1.115035
president~ct |  -3.915977     2.1442    -1.83   0.068    -8.118531    .2865775
previousP~ct |  -2.618633   1.261868    -2.08   0.038    -5.091848   -.1454174
previousPM~1 |   .4958572   .2007184     2.47   0.013     .1024564     .889258
previous_c~1 |   .0367127   .0403208     0.91   0.363    -.0423147    .1157401
-------------+----------------------------------------------------------------
SD           |
largestparty |   -4.72622   1.779758    -2.66   0.008    -8.214482   -1.237958
party_seat~e |  -.0074871   .0352742    -0.21   0.832    -.0766233    .0616491
medianparty1 |    .137813   .9798871     0.14   0.888     -1.78273    2.058356
presidentp~y |   -.266903   1.275177    -0.21   0.834    -2.766204    2.232398
  previousPM |   -1.90488   1.048407    -1.82   0.069     -3.95972    .1499603
president_~e |  -.4246113   1.592647    -0.27   0.790    -3.546143     2.69692
president~ct |   .5917079    1.45034     0.41   0.683    -2.250906    3.434321
previousP~ct |   -.133958   2.773063    -0.05   0.961    -5.569061    5.301145
previousPM~1 |     .11201   .2052589     0.55   0.585      -.29029    .5143099
previous_c~1 |   .1484155   .0862285     1.72   0.085    -.0205892    .3174201
------------------------------------------------------------------------------
The sign of the estimated standard deviations is irrelevant: interpret them as
being positive

. mixlpred mixprob;

. replace largestparty = largep2;
(753 real changes made)

. replace party_seatshare = ss2;
(753 real changes made)

. replace largestparty_east = largep2e;
(148 real changes made)

. replace party_seatshare_east = ss2e;
(148 real changes made)

. mixlpred mixprob2;

. replace largestparty = largep3;
(753 real changes made)

. replace party_seatshare = ss3;
(753 real changes made)

. replace largestparty_east = largep3e;
(148 real changes made)

. replace party_seatshare_east = ss3e;
(148 real changes made)

. generate mixdiff = mixprob2 - mixprob;
(373 missing values generated)

. generate cldiff = clprob2 - clprob;
(373 missing values generated)

. generate cldiff2 = cldiff^2;
(373 missing values generated)

. generate cldiff3 = cldiff^3;
(373 missing values generated)

. generate cldiff4 = cldiff^4;
(373 missing values generated)

. generate cldiff5 = cldiff^5;
(373 missing values generated)

. regress mixdiff cldiff cldiff2 cldiff3 cldiff4 cldiff5;

      Source |       SS       df       MS              Number of obs =    2039
-------------+------------------------------           F(  5,  2033) =12714.44
       Model |  134.810717     5  26.9621434           Prob > F      =  0.0000
    Residual |  4.31116545  2033  .002120593           R-squared     =  0.9690
-------------+------------------------------           Adj R-squared =  0.9689
       Total |  139.121883  2038  .068263927           Root MSE      =  .04605

------------------------------------------------------------------------------
     mixdiff |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      cldiff |    1.23558    .012656    97.63   0.000      1.21076      1.2604
     cldiff2 |   .0432221   .0150179     2.88   0.004       .01377    .0726741
     cldiff3 |  -1.569994   .0539017   -29.13   0.000    -1.675702   -1.464286
     cldiff4 |  -.0374185   .0228372    -1.64   0.101    -.0822053    .0073684
     cldiff5 |   1.327525   .0508851    26.09   0.000     1.227733    1.427318
       _cons |  -.0034637    .001172    -2.96   0.003    -.0057622   -.0011651
------------------------------------------------------------------------------

. predict pxb, xb;
(373 missing values generated)

. gen h = -1;

. replace h = 1 if _n==1;
(1 real change made)

. gen v = -1;

. replace v = 1 if _n==1;
(1 real change made)

. /* mark out points from hypothetical case */
> 
> generate mixdiffD = .;
(2412 missing values generated)

. replace mixdiffD = mixdiff if cabinetcode==1222 & partyID==7;
(1 real change made)

. replace mixdiffD = mixdiff if cabinetcode==1222 & partyID==13;
(1 real change made)

. generate mixdiffD2 = .;
(2412 missing values generated)

. replace mixdiffD2 = mixdiff if cabinetcode==1222 & partyID==22;
(1 real change made)

. generate mixdiffD3 = .;
(2412 missing values generated)

. replace mixdiffD3 = mixdiff if cabinetcode==1222 & partyID==10;
(1 real change made)

. generate partyname = "";
(2412 missing values generated)

. replace partyname = "PvdA" if cabinetcode==1222 & partyID==7;
partyname was str1 now str4
(1 real change made)

. replace partyname = "CDA" if cabinetcode==1222 & partyID==13;
(1 real change made)

. replace partyname = "VVD" if cabinetcode==1222 & partyID==22;
(1 real change made)

. replace partyname = "D66" if cabinetcode==1222 & partyID==10;
(1 real change made)

. sort cldiff;

. graph twoway (scatter mixdiff cldiff, msymbol(oh) mcolor(gs8) ylabel(-1 -0.5 0 0.5 1) xlabel(-1 -0.5 0 0.5 1) 
> ytitle("Mixed Logit Probability") xtitle("Conditional Logit Probability") plotregion(margin(zero)) legend(off)) 
> (line h v, lcolor(black) lwidth(thin)) (scatter pxb cldiff, connect(l) msymbol(i) lcolor(black))
> (scatter mixdiffD cldiff, msymbol(o) mcolor(black) mlabel(partyname) mlabcolor(black) mlabsize(small) mlabposition(3))
> (scatter mixdiffD2 cldiff, msymbol(o) mcolor(black) mlabel(partyname) mlabcolor(black) mlabsize(small) mlabposition(11))
> (scatter mixdiffD3 cldiff, msymbol(o) mcolor(black) mlabel(partyname) mlabcolor(black) mlabsize(small) mlabposition(4));

. 
end of do-file

. graph twoway (scatter mixdiff cldiff, msymbol(oh) mcolor(gs8) ylabel(-1 -0.5 0 0.5 1) xlabel(-1 -0.5 0 0.5 1) plotregion(margin(zero)) legend(off) yline(-0.5 0 0.5 10 0.2 0.4 0.6 0.8 1, lcolor(white)
> ) xtitle("" , size(2.5)) scheme(s2mono) graphregion(fcolor(white)))  (line h v, lcolor(black) lwidth(thin)) (scatter pxb cldiff, connect(l) msymbol(i) lcolor(black))  (scatter mixdiffD cldiff, msymbo
> l(o) mcolor(black) mlabel(partyname) mlabcolor(black) mlabsize(small) mlabposition(3)) (scatter mixdiffD2 cldiff, msymbol(o) mcolor(black) mlabel(partyname) mlabcolor(black) mlabsize(small) mlabposit
> ion(11))  (scatter mixdiffD3 cldiff, msymbol(o) mcolor(black) mlabel(partyname) mlabcolor(black) mlabsize(small) mlabposition(4))

. log close
      name:  <unnamed>
       log:  C:\fsu2010\formateur\ajps\submission2\replication\analysis\compprob.log
  log type:  text
 closed on:   6 Dec 2010, 18:11:39
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
